<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
</body>
<script type="text/javascript">
	var Single = function(fn){
		var ret;
		var fn = fn;
		return function(nodenm,text,prdom){
			if(!ret){
				return ret=fn.apply(this, arguments);
			}
			ret.innerHTML = nodenm;
			return ret;
		}
	};
	var creatdom = function(nodenm,text,prdom){
		/*
		*nodenm 标签的名称
		*text 标签的内容
		*prdom 父元素
		*/
		var nodenm = nodenm||'div',
			text = text||'这是个div',
			prdom = prdom||document.body;
		if( !isdom(prdom)|| typeof nodenm!=="string" || typeof text!=="string"){
			alert("请传入正确的参数");
		}
		function isdom(node){
			return (node===document.body)?true:document.body.contains(node);
		}
		var dom = document.createElement(nodenm);
		dom.innerHTML = text;
		// dom.style.display = 'none';
		prdom.appendChild(dom);
		return dom;
	}
	var singleDiv = Single(creatdom);
	console.log(singleDiv)
	singleDiv('div',"435435")
	singleDiv('div',"435435")
	singleDiv('6666666666',"66666666666")


	// var singleDiv = Single(creatdiv('div','werwerwe'));

</script>
</html>